<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例2-index</title>
    <script>
        function show(){
            let flag = confirm("确定要跳转吗?");
            if(flag) {
                location.href = "detail.html"
            }
        }

        function loadindex(){
            //重新加载页面
            location.reload()
        }
    </script>
</head>
<body>
    <h2>示例2-index</h2>
    <button onclick="show()">查看商品详情</button>
    <button onclick="loadindex()">刷新主页面</button>
</body>
</html>